package com.baway.park

//import coil3.ImageLoader
//import coil3.PlatformContext
//import coil3.SingletonImageLoader
//import coil3.network.okhttp.OkHttpNetworkFetcherFactory
//import coil3.request.crossfade
import com.baway.base.app.BaseApp
import com.baway.db.RoomDBUtils
//import com.facebook.drawee.backends.pipeline.Fresco
//import com.squareup.picasso.Picasso
import dagger.hilt.android.HiltAndroidApp
//import okhttp3.Headers
//import okhttp3.Interceptor
//import okhttp3.OkHttpClient
//import okhttp3.Response

/**
 * Author: Jason Zhang
 * Date: 2025/8/15
 * Desc: APP
 */

@HiltAndroidApp
class ParkApp: BaseApp() {


    override fun onCreate() {
        super.onCreate()

        //初始化Picasso
        //Picasso.setSingletonInstance(Picasso.Builder(this).build())

        //初始化Fresco
        //Fresco.initialize(this)

        //初始化数据库
        RoomDBUtils.initRoom(this)

    }

    /**
     * 自定义Coil图片加载器
     */
//    override fun newImageLoader(context: PlatformContext): ImageLoader {
//        return ImageLoader.Builder(context)
//            .crossfade(true)
//            .components {
//                add(
//                    OkHttpNetworkFetcherFactory(
//                        callFactory = {
//                            OkHttpClient().newBuilder()
//                                .addNetworkInterceptor(Interceptor {
//                                    val headers = Headers.Builder() .set("Cache-Control", "no-cache").build()
//                                    val request = it.request().newBuilder().headers(headers).build()
//                                    it.proceed(request)
//                                })
//                                .build()
//                        }
//                    )
//                )
//            }
//            .build()
//    }


}